package org.netEase.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.netEase.dao.zhanghuDao;
import org.netEase.dao.impl.zhanghuimpl;
import org.netEase.entity.zhanghu;

import com.sun.xml.internal.ws.wsdl.writer.document.Documented;

import javafx.scene.control.Alert;

@WebServlet(urlPatterns= {"/zhuce.html"})
public class ZhuCe extends HttpServlet {
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String name=request.getParameter("name");
		String password=request.getParameter("password");
		String pione=request.getParameter("pione");
		zhanghu zh=new zhanghu();
		zh.setName(name);
		zh.setPassword(password);
		zh.setPione(pione);
		 zhanghuDao zhanghudao=new zhanghuimpl();
		  int result=zhanghudao.add(zh);
		  if(result > 0){
			 
			  request.getRequestDispatcher("/index.html").forward(request, response);
			}
		
		
	}
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		this.doGet(request, response);
	}

}
